﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DotNet.Random.Mobile
{
    /// <summary>
    /// 中国联通手机号随机类，实现了接口IStringRandService
    /// </summary>
    public class ChinaUnicomNumRandService : Interface.IStringRandService
    {
        /// <summary>
        /// Rands this instance.
        /// 随机生成字符串方法
        /// 映射到虚方法中，扩展时，可重写
        /// </summary>
        /// <returns>
        /// 返回字符串类型
        /// </returns>
        public virtual string Rand()
        {
            var preffixRand = new ChinaUnicomSuffixRandService();
            var preffix = preffixRand.Rand();

            var suffix = new List<int>();
            var suffixRand = new Int.TenNumberRandService();
            for (int i = 0; i < 8; i++)
            {
                suffix.Add(suffixRand.Rand());
                System.Threading.Thread.Sleep(200);
            }
            var res = string.Join("", preffix, suffix);
            return res;
        }
    }
}
